package cn.happy.dao.impl;

import java.io.Serializable;
import org.hibernate.SessionFactory;
import cn.happy.beans.Stock;
import cn.happy.dao.IStockDAO;

public class StockDAOImpl implements IStockDAO {
    
	//SessionFactory
	private SessionFactory sessionFactory;
	
	public int addStock(Stock stock) {
		Serializable count = sessionFactory.getCurrentSession().save(stock);
		return ((Integer)count).intValue();
	}
	
	public SessionFactory getSessionFactory() {
		return sessionFactory;
	}

	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}

}
